//! \file linux_elf_utils.h

#include <link.h>

#include "defs.h"

//------------------------------------------------------------------------------

#ifndef _LINUX_ELF_UTILS_H_
#define _LINUX_ELF_UTILS_H_

//------------------------------------------------------------------------------

//#define ELF_HEADER_BEGIN 0x08048000 //i386
#define ELF_HEADER_BEGIN 0x8000 //ARM

//------------------------------------------------------------------------------

TBGError ElfFindSegment(const int segment_type, unsigned long elf_load_addr,
                        Elf32_Phdr *ret_phdr);

TBGError ElfLocateLinkmap(unsigned long elf_header_begin,
                          struct link_map *plink_map);

TBGError ElfGetDynSym(struct link_map *plink_map, Elf32_Sword type,
                      Elf32_Dyn *pdyn);

//------------------------------------------------------------------------------

#endif //_LINUX_ELF_UTILS_H_

